package org.example.pattern;

//线程安全的懒惰模式
public class SingletonPattern2 {
    private static SingletonPattern2 instance;

    private SingletonPattern2(){}

    public static synchronized SingletonPattern2 getInstance() {
        if (instance == null) {
            return new SingletonPattern2();
        }
        return instance;
    }
}
